package dryven.config.xml.jdbctags;

import org.xml.sax.Attributes;

import dryven.config.xml.AbstractJdbcConfigurationElement;
import dryven.config.xml.MemoryApplicationConfiguration;
import dryven.config.xml.MemoryDatabaseConfiguration;

public class JdbcConfigurationElement extends AbstractJdbcConfigurationElement {

	@Override
	public MemoryDatabaseConfiguration readConnection(Attributes elementAttributes) {
		String driver = elementAttributes.getValue("","driver");
		String url = elementAttributes.getValue("","url");
		String pass = elementAttributes.getValue("","pass");
		String user = elementAttributes.getValue("","user");
		
		MemoryDatabaseConfiguration cfg = new MemoryDatabaseConfiguration();
		cfg.setJDBCUrl(url);
		cfg.setDriverClass(driver);
		cfg.setPassword(pass);
		cfg.setUsername(user);
		return cfg;
	}

}
